unit heContnrs_VectorMap_test;

{$mode objfpc}{$H+}

interface

uses
  Classes,
  fpcunit,
  heContnrs,
  heContnrs_test;

type

  TVectorMapIntKey = type Integer;
  TVectorMapIntValue = type Integer;

  { TTestVectorMapInt }

  _TTestVectorMapInt = specialize TheVectorMap<TVectorMapIntKey, TVectorMapIntValue>;
  TTestVectorMapInt = class(_TTestVectorMapInt)
  private
    FID: Integer;
    FTracer: TBits;
    procedure RunInheritedMissingKeyValue;
  protected
    function MissingKeyValue(const AKey: TVectorMapIntKey): TVectorMapIntValue; override;
  public
    constructor Create(const ATracer: TBits; const AID: Integer);
    destructor Destroy; override;
    property ID: Integer read FID;
    property Tracer: TBits read FTracer;
  end;

  TVectorMapStrKey = type String;
  TVectorMapStrValue = type String;

  { TTestVectorMapStr }

  _TTestVectorMapStr = specialize TheVectorMap<TVectorMapStrKey, TVectorMapStrValue>;
  TTestVectorMapStr = class(_TTestVectorMapStr)
  private
    FID: Integer;
    FTracer: TBits;
    procedure RunInheritedMissingKeyValue;
  protected
    function MissingKeyValue(const AKey: TVectorMapStrKey): TVectorMapStrValue; override;
  public
    constructor Create(const ATracer: TBits; const AID: Integer);
    destructor Destroy; override;
    property ID: Integer read FID;
    property Tracer: TBits read FTracer;
  end;

  TCmpVectorMapIntKey = type Integer;
  TCmpVectorMapIntValue = type Integer;

  { TTestCmpVectorMapInt }

  _TTestCmpVectorMapInt = specialize TheCmpVectorMap<TCmpVectorMapIntKey, TCmpVectorMapIntValue>;
  TTestCmpVectorMapInt = class(_TTestCmpVectorMapInt)
  private
    FID: Integer;
    FTracer: TBits;
    procedure RunInheritedMissingKeyValue;
  protected
    function MissingKeyValue(const AKey: TCmpVectorMapIntKey): TVectorMapIntValue; override;
  public
    constructor Create(const ATracer: TBits; const AID: Integer);
    destructor Destroy; override;
    function Compare(const A, B: TCmpVectorMapIntKey): Integer; override;
    property ID: Integer read FID;
    property Tracer: TBits read FTracer;
  end;

  TCmpVectorMapStrKey = type String;
  TCmpVectorMapStrValue = type String;

  { TTestCmpVectorMapStr }

  _TTestCmpVectorMapStr = specialize TheCmpVectorMap<TCmpVectorMapStrKey, TCmpVectorMapStrValue>;
  TTestCmpVectorMapStr = class(_TTestCmpVectorMapStr)
  private
    FID: Integer;
    FTracer: TBits;
    procedure RunInheritedMissingKeyValue;
  protected
    function MissingKeyValue(const AKey: TCmpVectorMapStrKey): TCmpVectorMapStrValue; override;
  public
    constructor Create(const ATracer: TBits; const AID: Integer);
    destructor Destroy; override;
    function Compare(const A, B: TCmpVectorMapStrKey): Integer; override;
    property ID: Integer read FID;
    property Tracer: TBits read FTracer;
  end;

  ICmpVectorMapInterfaceKey = type IInterface;
  ICmpVectorMapInterfaceValue = type IInterface;

  { TTestCmpVectorMapInterface }

  _TTestCmpVectorMapInterface = specialize TheCmpVectorMap<ICmpVectorMapInterfaceKey, ICmpVectorMapInterfaceValue>;
  TTestCmpVectorMapInterface = class(_TTestCmpVectorMapInterface)
  private
    FID: Integer;
    FTracer: TBits;
    procedure RunInheritedMissingKeyValue;
  protected
    function MissingKeyValue(const AKey: ICmpVectorMapInterfaceKey): ICmpVectorMapInterfaceValue; override;
  public
    constructor Create(const ATracer: TBits; const AID: Integer);
    destructor Destroy; override;
    function Compare(const A, B: ICmpVectorMapInterfaceKey): Integer; override;
    property ID: Integer read FID;
    property Tracer: TBits read FTracer;
  end;

  { TTestObjectVectorMap }

  _TTestObjectVectorMap = specialize TheObjectVectorMap<String, TTracedObject>;
  TTestObjectVectorMap = class(_TTestObjectVectorMap)
  private
    FID: Integer;
    FTracer: TBits;
    procedure RunInheritedMissingKeyValue;
  protected
    function MissingKeyValue(const AKey: String): TTracedObject; override;
  public
    constructor Create(const ATracer: TBits; const AID: Integer; const AOwnObjects: Boolean = True);
    destructor Destroy; override;
    function Compare(const A, B: String): Integer; override;
    property ID: Integer read FID;
    property Tracer: TBits read FTracer;
  end;

  { TheVectorMapTest }

  generic TheVectorMapTest<TVector, TKey, TValue, TItem> = class(TTestCase)
  private
    Map: TVector;
  protected
    procedure Done(const V: TValue); virtual;
    function Int2Key(const N: Integer): TKey; virtual; // abstract;
    function Key2Int(const K: TKey): Integer; virtual; // abstract;
    function Int2Value(const N: Integer): TValue; virtual; // abstract;
    function Value2Int(const V: TValue): Integer; virtual; // abstract;
    procedure SetUp; override;
    procedure TearDown; override;
  published
    procedure TestCreate;
    procedure TestCount;
    procedure TestMissingKeyValue;
    procedure TestClear;
    procedure TestPack;
    procedure TestFirst;
    procedure TestLast;
    procedure TestFind;
    procedure TestIndexOf;
    procedure TestHas;
    //procedure TestKeys;
    //procedure TestKeysReversed;
    //procedure TestValues;
    //procedure TestValuesReversed;
    procedure TestKey;
    procedure TestValue;
    procedure TestItem;
    procedure TestExtract;
    procedure TestDelete;
    procedure TestRemove;
    procedure TestMap;
  end;

  { TheIntVectorMapTest }

  _TheIntVectorMapTest = specialize TheVectorMapTest<TTestVectorMapInt, Integer, Integer, TTestVectorMapInt.TItem>;
  TheIntVectorMapTest = class(_TheIntVectorMapTest)
  protected
    function Int2Key(const N: Integer): Integer; override;
    function Key2Int(const K: Integer): Integer; override;
    function Int2Value(const N: Integer): Integer; override;
    function Value2Int(const V: Integer): Integer; override;
  published
    procedure TestKeys;
    procedure TestKeysReversed;
    procedure TestValues;
    procedure TestValuesReversed;
  end;

  { TheStrVectorMapTest }

  _TheStrVectorMapTest = specialize TheVectorMapTest<TTestVectorMapStr, String, String, TTestVectorMapStr.TItem>;
  TheStrVectorMapTest = class(_TheStrVectorMapTest)
  protected
    function Int2Key(const N: Integer): String; override;
    function Key2Int(const K: String): Integer; override;
    function Int2Value(const N: Integer): String; override;
    function Value2Int(const V: String): Integer; override;
  published
    procedure TestKeys;
    procedure TestKeysReversed;
    procedure TestValues;
    procedure TestValuesReversed;
  end;

  { TheIntCmpVectorMapTest }

  _TheIntCmpVectorMapTest = specialize TheVectorMapTest<TTestCmpVectorMapInt, Integer, Integer, TTestCmpVectorMapInt.TItem>;
  TheIntCmpVectorMapTest = class(_TheIntCmpVectorMapTest)
  protected
    function Int2Key(const N: Integer): Integer; override;
    function Key2Int(const K: Integer): Integer; override;
    function Int2Value(const N: Integer): Integer; override;
    function Value2Int(const V: Integer): Integer; override;
  published
    procedure TestKeys;
    procedure TestKeysReversed;
    procedure TestValues;
    procedure TestValuesReversed;
  end;

  { TheStrCmpVectorMapTest }

  _TheStrCmpVectorMapTest = specialize TheVectorMapTest<TTestCmpVectorMapStr, String, String, TTestCmpVectorMapStr.TItem>;
  TheStrCmpVectorMapTest = class(_TheStrCmpVectorMapTest)
  protected
    function Int2Key(const N: Integer): String; override;
    function Key2Int(const K: String): Integer; override;
    function Int2Value(const N: Integer): String; override;
    function Value2Int(const V: String): Integer; override;
  published
    procedure TestKeys;
    procedure TestKeysReversed;
    procedure TestValues;
    procedure TestValuesReversed;
  end;

  { TheInterfaceCmpVectorMapTest }

  _TheInterfaceCmpVectorMapTest = specialize TheVectorMapTest<TTestCmpVectorMapInterface, ICmpVectorMapInterfaceKey, ICmpVectorMapInterfaceValue, TTestCmpVectorMapInterface.TItem>;
  TheInterfaceCmpVectorMapTest = class(_TheInterfaceCmpVectorMapTest)
  protected
    function Int2Key(const N: Integer): ICmpVectorMapInterfaceKey; override;
    function Key2Int(const K: ICmpVectorMapInterfaceKey): Integer; override;
    function Int2Value(const N: Integer): ICmpVectorMapInterfaceValue; override;
    function Value2Int(const V: ICmpVectorMapInterfaceValue): Integer; override;
  published
    procedure TestKeys;
    procedure TestKeysReversed;
    procedure TestValues;
    procedure TestValuesReversed;
  end;

  { TheObjectVectorMapTest }

  _TheObjectVectorMapTest = specialize TheVectorMapTest<TTestObjectVectorMap, String, TTracedObject, TTestObjectVectorMap.TItem>;
  TheObjectVectorMapTest = class(_TheObjectVectorMapTest)
  protected
    procedure Done(const V: TTracedObject); override;
    function Int2Key(const N: Integer): String; override;
    function Key2Int(const K: String): Integer; override;
    function Int2Value(const N: Integer): TTracedObject; override;
    function Value2Int(const V: TTracedObject): Integer; override;
  published
    procedure TestCreate2;
    procedure TestCreate3;
    procedure TestKeys;
    procedure TestKeysReversed;
    procedure TestValues;
    procedure TestValuesReversed;
  end;

implementation

uses
  SysUtils,
  testregistry;

const
  NO_VAL = '<no value>';

{ TTestVectorMapInt }

procedure TTestVectorMapInt.RunInheritedMissingKeyValue;
begin
  inherited MissingKeyValue(0);
end;

function TTestVectorMapInt.MissingKeyValue(const AKey: TVectorMapIntKey): TVectorMapIntValue;
begin
  Assert(AKey = AKey); // hint off
  Result := Low(TVectorMapIntKey);
end;

constructor TTestVectorMapInt.Create(const ATracer: TBits; const AID: Integer);
begin
  inherited Create;
  FTracer := ATracer;
  FID := AID;
  if Tracer <> nil then
    Tracer[ID] := True;
end;

destructor TTestVectorMapInt.Destroy;
begin
  if Tracer <> nil then
    Tracer[ID] := False;
  inherited Destroy;
end;

{ TTestVectorMapStr }

procedure TTestVectorMapStr.RunInheritedMissingKeyValue;
begin
  inherited MissingKeyValue('<missing key>');
end;

function TTestVectorMapStr.MissingKeyValue(const AKey: TVectorMapStrKey): TVectorMapStrValue;
begin
  Assert(AKey = AKey); // hint off
  Result := NO_VAL;
end;

constructor TTestVectorMapStr.Create(const ATracer: TBits; const AID: Integer);
begin
  inherited Create;
  FTracer := ATracer;
  FID := AID;
  if Tracer <> nil then
    Tracer[ID] := True;
end;

destructor TTestVectorMapStr.Destroy;
begin
  if Tracer <> nil then
    Tracer[ID] := False;
  inherited Destroy;
end;

{ TTestCmpVectorMapInt }

procedure TTestCmpVectorMapInt.RunInheritedMissingKeyValue;
begin
  inherited MissingKeyValue(0);
end;

function TTestCmpVectorMapInt.MissingKeyValue(const AKey: TCmpVectorMapIntKey): TVectorMapIntValue;
begin
  Assert(AKey = AKey); // hint off
  Result := Low(TVectorMapIntKey);
end;

constructor TTestCmpVectorMapInt.Create(const ATracer: TBits; const AID: Integer);
begin
  inherited Create;
  FTracer := ATracer;
  FID := AID;
  if Tracer <> nil then
    Tracer[ID] := True;
end;

destructor TTestCmpVectorMapInt.Destroy;
begin
  if Tracer <> nil then
    Tracer[ID] := False;
  inherited Destroy;
end;

function TTestCmpVectorMapInt.Compare(const A, B: TCmpVectorMapIntKey): Integer;
begin
  Result := A - B;
end;

{ TTestCmpVectorMapStr }

procedure TTestCmpVectorMapStr.RunInheritedMissingKeyValue;
begin
  inherited MissingKeyValue('<missing key>');
end;

function TTestCmpVectorMapStr.MissingKeyValue(const AKey: TCmpVectorMapStrKey): TCmpVectorMapStrValue;
begin
  Assert(AKey = AKey); // hint off
  Result := NO_VAL;
end;

constructor TTestCmpVectorMapStr.Create(const ATracer: TBits; const AID: Integer);
begin
  inherited Create;
  FTracer := ATracer;
  FID := AID;
  if Tracer <> nil then
    Tracer[ID] := True;
end;

destructor TTestCmpVectorMapStr.Destroy;
begin
  if Tracer <> nil then
    Tracer[ID] := False;
  inherited Destroy;
end;

function TTestCmpVectorMapStr.Compare(const A, B: TCmpVectorMapStrKey): Integer;
begin
  Result := CompareStr(A, B);
end;

{ TTestCmpVectorMapInterface }

procedure TTestCmpVectorMapInterface.RunInheritedMissingKeyValue;
var AKey: ICmpVectorMapInterfaceKey;
begin
  AKey := nil;
  inherited MissingKeyValue(AKey);
end;

function TTestCmpVectorMapInterface.MissingKeyValue(const AKey: ICmpVectorMapInterfaceKey): ICmpVectorMapInterfaceValue;
begin
  Assert(AKey = AKey); // hint off
  Result := TInterfacedTracedObject.Create(nil, Low(Integer)) as ICmpVectorMapInterfaceValue;
end;

constructor TTestCmpVectorMapInterface.Create(const ATracer: TBits; const AID: Integer);
begin
  inherited Create;
  FTracer := ATracer;
  FID := AID;
  if Tracer <> nil then
    Tracer[ID] := True;
end;

destructor TTestCmpVectorMapInterface.Destroy;
begin
  if Tracer <> nil then
    Tracer[ID] := False;
  inherited Destroy;
end;

function TTestCmpVectorMapInterface.Compare(const A, B: ICmpVectorMapInterfaceKey): Integer;
begin
  if (A = nil) then
    if B = nil then
      Exit(0)
    else
      Exit(1)
  else if B = nil then
    if A = nil then
      Exit(0)
    else
      Exit(-1);
  Result := (A as TInterfacedTracedObject).ID - (B as TInterfacedTracedObject).ID;
end;

{ TTestObjectVectorMap }

procedure TTestObjectVectorMap.RunInheritedMissingKeyValue;
begin
  inherited MissingKeyValue('<missing key>');
end;

function TTestObjectVectorMap.MissingKeyValue(const AKey: String ): TTracedObject;
begin
  Assert(AKey = AKey); // hint off
  Result := nil;
end;

constructor TTestObjectVectorMap.Create(const ATracer: TBits; const AID: Integer; const AOwnObjects: Boolean);
begin
  inherited Create(AOwnObjects);
  FTracer := ATracer;
  FID := AID;
  if Tracer <> nil then
    Tracer[ID] := True;
end;

destructor TTestObjectVectorMap.Destroy;
begin
  if Tracer <> nil then
    Tracer[ID] := False;
  inherited Destroy;
end;

function TTestObjectVectorMap.Compare(const A, B: String): Integer;
begin
  Result := CompareStr(A, B);
end;

{ TheIntVectorMapTest }

function TheIntVectorMapTest.Int2Key(const N: Integer): Integer;
begin
  Result := N;
end;

function TheIntVectorMapTest.Key2Int(const K: Integer): Integer;
begin
  Result := K;
end;

function TheIntVectorMapTest.Int2Value(const N: Integer): Integer;
begin
  Result := N;
end;

function TheIntVectorMapTest.Value2Int(const V: Integer): Integer;
begin
  Result := V;
end;

procedure TheIntVectorMapTest.TestKeys;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Keys do begin
      AssertEquals('V', Value2Int(A[J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheIntVectorMapTest.TestKeysReversed;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.KeysReversed do begin
      AssertEquals('V', Value2Int(A[I - J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheIntVectorMapTest.TestValues;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Values do begin
      AssertEquals('V', Value2Int(A[J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheIntVectorMapTest.TestValuesReversed;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.ValuesReversed do begin
      AssertEquals('V', Value2Int(A[I - J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

{ TheStrVectorMapTest }

function TheStrVectorMapTest.Int2Key(const N: Integer): String;
begin
  Result := Format('%.8d', [N]);
end;

function TheStrVectorMapTest.Key2Int(const K: String): Integer;
begin
  Result := StrToInt(K);
end;

function TheStrVectorMapTest.Int2Value(const N: Integer): String;
begin
  Result := Format('%.8d', [N]);
end;

function TheStrVectorMapTest.Value2Int(const V: String): Integer;
begin
  Result := StrToIntDef(V, Low(Integer));
end;

procedure TheStrVectorMapTest.TestKeys;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Keys do begin
      AssertEquals('V', Value2Int(A[J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheStrVectorMapTest.TestKeysReversed;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.KeysReversed do begin
      AssertEquals('V', Value2Int(A[I - J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheStrVectorMapTest.TestValues;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Values do begin
      AssertEquals('V', Value2Int(A[J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheStrVectorMapTest.TestValuesReversed;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.ValuesReversed do begin
      AssertEquals('V', Value2Int(A[I - J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

{ TheIntCmpVectorMapTest }

function TheIntCmpVectorMapTest.Int2Key(const N: Integer): Integer;
begin
  Result := N;
end;

function TheIntCmpVectorMapTest.Key2Int(const K: Integer): Integer;
begin
  Result := K;
end;

function TheIntCmpVectorMapTest.Int2Value(const N: Integer): Integer;
begin
  Result := N;
end;

function TheIntCmpVectorMapTest.Value2Int(const V: Integer): Integer;
begin
  Result := V;
end;

procedure TheIntCmpVectorMapTest.TestKeys;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Keys do begin
      AssertEquals('V', Value2Int(A[J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheIntCmpVectorMapTest.TestKeysReversed;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.KeysReversed do begin
      AssertEquals('V', Value2Int(A[I - J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheIntCmpVectorMapTest.TestValues;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Values do begin
      AssertEquals('V', Value2Int(A[J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheIntCmpVectorMapTest.TestValuesReversed;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.ValuesReversed do begin
      AssertEquals('V', Value2Int(A[I - J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

{ TheStrCmpVectorMapTest }

function TheStrCmpVectorMapTest.Int2Key(const N: Integer): String;
begin
  Result := Format('%.8d', [N]);
end;

function TheStrCmpVectorMapTest.Key2Int(const K: String): Integer;
begin
  Result := StrToInt(K);
end;

function TheStrCmpVectorMapTest.Int2Value(const N: Integer): String;
begin
  Result := Format('%.8d', [N]);
end;

function TheStrCmpVectorMapTest.Value2Int(const V: String): Integer;
begin
  Result := StrToIntDef(V, Low(Integer));
end;

procedure TheStrCmpVectorMapTest.TestKeys;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Keys do begin
      AssertEquals('V', Value2Int(A[J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheStrCmpVectorMapTest.TestKeysReversed;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.KeysReversed do begin
      AssertEquals('V', Value2Int(A[I - J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheStrCmpVectorMapTest.TestValues;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Values do begin
      AssertEquals('V', Value2Int(A[J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheStrCmpVectorMapTest.TestValuesReversed;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.ValuesReversed do begin
      AssertEquals('V', Value2Int(A[I - J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

{ TheInterfaceCmpVectorMapTest }

function TheInterfaceCmpVectorMapTest.Int2Key(const N: Integer): ICmpVectorMapInterfaceKey;
begin
  Result := TInterfacedTracedObject.Create(nil, N) as ICmpVectorMapInterfaceKey;
end;

function TheInterfaceCmpVectorMapTest.Key2Int(const K: ICmpVectorMapInterfaceKey): Integer;
begin
  Result := (K as TInterfacedTracedObject).ID;
end;

function TheInterfaceCmpVectorMapTest.Int2Value(const N: Integer): ICmpVectorMapInterfaceValue;
begin
  Result := TInterfacedTracedObject.Create(nil, N) as ICmpVectorMapInterfaceValue;
end;

function TheInterfaceCmpVectorMapTest.Value2Int(const V: ICmpVectorMapInterfaceValue): Integer;
begin
  Result := (V as TInterfacedTracedObject).ID;
end;

procedure TheInterfaceCmpVectorMapTest.TestKeys;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Keys do begin
      AssertEquals('V', Value2Int(A[J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheInterfaceCmpVectorMapTest.TestKeysReversed;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.KeysReversed do begin
      AssertEquals('V', Value2Int(A[I - J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheInterfaceCmpVectorMapTest.TestValues;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Values do begin
      AssertEquals('V', Value2Int(A[J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheInterfaceCmpVectorMapTest.TestValuesReversed;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.ValuesReversed do begin
      AssertEquals('V', Value2Int(A[I - J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

{ TheObjectVectorMapTest }

procedure TheObjectVectorMapTest.Done(const V: TTracedObject);
begin
  V.Free;
end;

function TheObjectVectorMapTest.Int2Key(const N: Integer): String;
begin
  Result := Format('%.8d', [N]);
end;

function TheObjectVectorMapTest.Key2Int(const K: String): Integer;
begin
  Result := StrToInt(K);
end;

function TheObjectVectorMapTest.Int2Value(const N: Integer): TTracedObject;
begin
  Result := TTracedObject.Create(nil, N);
end;

function TheObjectVectorMapTest.Value2Int(const V: TTracedObject): Integer;
begin
  if V <> nil then
    Result := V.ID
  else
    Result := Low(Integer);
end;

procedure TheObjectVectorMapTest.TestCreate2;
var
  Tracer: TBits;
  L: TTestObjectVectorMap;
begin
  L := TTestObjectVectorMap.Create(nil, 0);
  try
    AssertTrue(L.OwnObjects);
    Tracer := TBits.Create;
    try
      L['foo'] := TTracedObject.Create(Tracer, 1);
      L.Clear;
      AssertFalse('Item dead', Tracer[1]);
    finally
      Tracer.Free;
    end;
  finally
    L.Free;
  end;
end;

procedure TheObjectVectorMapTest.TestCreate3;
var
  Tracer: TBits;
  L: TTestObjectVectorMap;
  Obj: TTracedObject;
begin
  L := TTestObjectVectorMap.Create(nil, 0, False);
  try
    AssertFalse(L.OwnObjects);
    Tracer := TBits.Create;
    try
      Obj := TTracedObject.Create(Tracer, 1);
      try
        L['foo'] := Obj;
        L.Clear;
        AssertTrue('Item alive', Tracer[1]);
      finally
        Obj.Free;
      end;
    finally
      Tracer.Free;
    end;
  finally
    L.Free;
  end;
end;

procedure TheObjectVectorMapTest.TestKeys;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Keys do begin
      AssertEquals('V', Value2Int(A[J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheObjectVectorMapTest.TestKeysReversed;
const N = 10;
var
  I, J: Integer;
  V: TKey;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.KeysReversed do begin
      AssertEquals('V', Value2Int(A[I - J]) - 1000, Key2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheObjectVectorMapTest.TestValues;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.Values do begin
      AssertEquals('V', Value2Int(A[J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

procedure TheObjectVectorMapTest.TestValuesReversed;
const N = 10;
var
  I, J: Integer;
  V: TValue;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    J := 0;
    for V in Map.ValuesReversed do begin
      AssertEquals('V', Value2Int(A[I - J]), Value2Int(V));
      Inc(J);
    end;
    AssertEquals('J', I + 1, J);
  end;
end;

{ TheVectorMapTest }

procedure TheVectorMapTest.Done(const V: TValue);
begin
  Assert(@V = @V); // hint off
  // nop
end;

function TheVectorMapTest.Int2Key(const N: Integer): TKey;
begin
  Assert(N = N); // hint off
  Initialize(Result); // hint off
  raise EAbstractError.Create(Format('%s.Int2Key', [ClassName]));
end;

function TheVectorMapTest.Key2Int(const K: TKey): Integer;
begin
  Assert(@K = @K); // hint off
  Result := 0; // hint off
  raise EAbstractError.Create(Format('%s.Key2Int', [ClassName]));
end;

function TheVectorMapTest.Int2Value(const N: Integer): TValue;
begin
  Assert(N = N); // hint off
  Initialize(Result); // hint off
  raise EAbstractError.Create(Format('%s.Int2Value', [ClassName]));
end;

function TheVectorMapTest.Value2Int(const V: TValue): Integer;
begin
  Assert(@V = @V); // hint off
  Result := 0; // hint off
  raise EAbstractError.Create(Format('%s.Value2Int', [ClassName]));
end;

procedure TheVectorMapTest.SetUp;
begin
  Map := TVector.Create(nil, 0);
end;

procedure TheVectorMapTest.TearDown;
begin
  FreeAndNil(Map);
end;

procedure TheVectorMapTest.TestCreate;
begin
  AssertEquals('Initial .Count', 0, Map.Count);
end;

procedure TheVectorMapTest.TestCount;
begin
  AssertEquals('.Count', 0, Map.Count);
  Map[Int2Key(0)] := Int2Value(100);
  AssertEquals('.Count', 1, Map.Count);
  Done(Map.Value[0]);
  Map.Delete(0);
  AssertEquals('.Count', 0, Map.Count);
end;

procedure TheVectorMapTest.TestMissingKeyValue;
begin
  AssertEquals('a) V[0]', Low(Integer), Value2Int(Map[Int2Key(0)]));
  AssertException('.MissingKeyValue', EMapKeyNotFound, @Map.RunInheritedMissingKeyValue);
  Map[Int2Key(0)] := Int2Value(100);
  AssertEquals('b) V[0]', 100, Value2Int(Map[Int2Key(0)]));
  Done(Map.Value[0]);
  Map.Delete(0);
  AssertEquals('c) V[0]', Low(Integer), Value2Int(Map[Int2Key(0)]));
end;

procedure TheVectorMapTest.TestClear;
const N = 10;
var I: Integer;
begin
  for I := 0 to N - 1 do
    Map[Int2Key(I)] := Int2Value(10 * I);
  Map.Clear;
  AssertEquals('.Count', 0, Map.Count);
end;

procedure TheVectorMapTest.TestPack;
const N = 11;
var I: Integer;
begin
  for I := 0 to N - 1 do
    Map[Int2Key(I)] := Int2Value(10 * I);
  Map.Capacity := 2 * N;
  AssertEquals('a) .Capacity', 2 * N, Map.Capacity);
  Map.Pack;
  AssertEquals('b) .Capacity', Map.Count, Map.Capacity);
end;

procedure TheVectorMapTest.TestFirst;
begin
  Map[Int2Key(100)] := Int2Value(1000);
  AssertEquals('a) .First', 100, Key2Int(Map.First.Key));
  AssertEquals('b) .First', 1000, Value2Int(Map.First.Value));
  Map[Int2Key(200)] := Int2Value(2000);
  AssertEquals('c) .First', 100, Key2Int(Map.First.Key));
  AssertEquals('d) .First', 1000, Value2Int(Map.First.Value));
end;

procedure TheVectorMapTest.TestLast;
begin
  Map[Int2Key(100)] := Int2Value(1000);
  AssertEquals('a) .Last', 100, Key2Int(Map.Last.Key));
  AssertEquals('b) .Last', 1000, Value2Int(Map.Last.Value));
  Map[Int2Key(200)] := Int2Value(2000);
  AssertEquals('c) .Last', 200, Key2Int(Map.Last.Key));
  AssertEquals('d) .Last', 2000, Value2Int(Map.Last.Value));
end;

procedure TheVectorMapTest.TestFind;
var Index: Integer = 0; // hint off
begin
  AssertFalse('a) .Find', Map.Find(Int2Key(-1), Index));
  Map[Int2Key(100)] := Int2Value(1000);
  AssertFalse('b) .Find', Map.Find(Int2Key(-1), Index));
  AssertTrue('c) .Find', Map.Find(Int2Key(100), Index));
  AssertEquals('d) .Find', 0, Index);
  Map[Int2Key(200)] := Int2Value(2000);
  AssertFalse('e) .Find', Map.Find(Int2Key(-1), Index));
  AssertTrue('f) .Find', Map.Find(Int2Key(100), Index));
  AssertEquals('g) .Find', 0, Index);
  AssertTrue('h) .Find', Map.Find(Int2Key(200), Index));
  AssertEquals('i) .Find', 1, Index);
end;

procedure TheVectorMapTest.TestIndexOf;
begin
  AssertTrue('a) .IndexOf', Map.IndexOf(Int2Key(-1)) < 0);
  Map[Int2Key(100)] := Int2Value(1000);
  AssertTrue('b) .IndexOf', Map.IndexOf(Int2Key(-1)) < 0);
  AssertEquals('c) .IndexOf', 0, Map.IndexOf(Int2Key(100)));
  Map[Int2Key(200)] := Int2Value(2000);
  AssertTrue('d) .IndexOf', Map.IndexOf(Int2Key(-1)) < 0);
  AssertEquals('e) .IndexOf', 0, Map.IndexOf(Int2Key(100)));
  AssertEquals('f) .IndexOf', 1, Map.IndexOf(Int2Key(200)));
end;

procedure TheVectorMapTest.TestHas;
begin
  AssertFalse('a) .Has', Map.Has(Int2Key(-1)));
  Map[Int2Key(100)] := Int2Value(1000);
  AssertFalse('b) .Has', Map.Has(Int2Key(-1)));
  AssertTrue('c) .Has', Map.Has(Int2Key(100)));
  Map[Int2Key(200)] := Int2Value(2000);
  AssertFalse('e) .Has', Map.Has(Int2Key(-1)));
  AssertTrue('f) .Has', Map.Has(Int2Key(100)));
  AssertTrue('h) .Has', Map.Has(Int2Key(200)));
end;

procedure TheVectorMapTest.TestKey;
const N = 10;
var
  I, J: Integer;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    for J := 0 to I do
      AssertEquals('V', J, Key2Int(Map.Key[J]));
  end;
end;

procedure TheVectorMapTest.TestValue;
const N = 10;
var
  I, J: Integer;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    for J := 0 to I do
      AssertEquals('V', Value2Int(A[J]), Value2Int(Map.Value[J]));
  end;
end;

procedure TheVectorMapTest.TestItem;
const N = 10;
var
  I, J: Integer;
  A: array[0..N - 1] of TValue;
begin
  for I := 0 to N - 1 do begin
    A[I] := Int2Value(1000 + I);
    Map[Int2Key(I)] := A[I];
    for J := 0 to I do begin
      AssertEquals('a) V', J, Key2Int(Map.Item[J].Key));
      AssertEquals('b) V', Value2Int(A[J]), Value2Int(Map.Item[J].Value));
    end;
  end;
end;

procedure TheVectorMapTest.TestExtract;
var Item: TItem;
begin
  Map[Int2Key(0)] := Int2Value(1000);
  Item := Map.Extract(0);
  try
    AssertEquals('a1) .Count', 0, Map.Count);
    AssertEquals('a2) Item', 0, Key2Int(Item.Key));
    AssertEquals('a3) Item', 1000, Value2Int(Item.Value));
  finally
    Done(Item.Value);
  end;
  TearDown;

  Setup;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  Item := Map.Extract(0);
  try
    AssertEquals('b1) .Count', 1, Map.Count);
    AssertEquals('b2) Item', 0, Key2Int(Item.Key));
    AssertEquals('b3) Item', 1000, Value2Int(Item.Value));
  finally
    Done(Item.Value);
  end;
  Item := Map.Item[0];
  AssertEquals('b4) Item', 1, Key2Int(Item.Key));
  AssertEquals('b5) Item', 1001, Value2Int(Item.Value));
  TearDown;

  Setup;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  Item := Map.Extract(1);
  try
    AssertEquals('c1) .Count', 1, Map.Count);
    AssertEquals('c2) Item', 1, Key2Int(Item.Key));
    AssertEquals('c3) Item', 1001, Value2Int(Item.Value));
  finally
    Done(Item.Value);
  end;
  Item := Map.Item[0];
  AssertEquals('c4) Item', 0, Key2Int(Item.Key));
  AssertEquals('c5) Item', 1000, Value2Int(Item.Value));
  TearDown;

  Setup;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  Map[Int2Key(2)] := Int2Value(1002);
  Item := Map.Extract(1);
  try
    AssertEquals('d1) .Count', 2, Map.Count);
    AssertEquals('d2) Item', 1, Key2Int(Item.Key));
    AssertEquals('d3) Item', 1001, Value2Int(Item.Value));
  finally
    Done(Item.Value);
  end;
  Item := Map.Item[0];
  AssertEquals('d4) Item', 0, Key2Int(Item.Key));
  AssertEquals('d5) Item', 1000, Value2Int(Item.Value));
  Item := Map.Item[1];
  AssertEquals('d6) Item', 2, Key2Int(Item.Key));
  AssertEquals('d7) Item', 1002, Value2Int(Item.Value));
  Assert(@Item = @Item); // hint off
end;

procedure TheVectorMapTest.TestDelete;
var Item: TItem;
begin
  Map[Int2Key(0)] := Int2Value(1000);
  Done(Map.Value[0]);
  Map.Delete(0);
  AssertEquals('a1) .Count', 0, Map.Count);
  TearDown;

  SetUp;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  Done(Map.Value[0]);
  Map.Delete(0);
  AssertEquals('b1) .Count', 1, Map.Count);
  Item := Map.Item[0];
  AssertEquals('b2) Item', 1, Key2Int(Item.Key));
  AssertEquals('b3) Item', 1001, Value2Int(Item.Value));
  TearDown;

  SetUp;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  Done(Map.Value[1]);
  Map.Delete(1);
  AssertEquals('c1) .Count', 1, Map.Count);
  Item := Map.Item[0];
  AssertEquals('c2) Item', 0, Key2Int(Item.Key));
  AssertEquals('c3) Item', 1000, Value2Int(Item.Value));
  TearDown;

  SetUp;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  Map[Int2Key(2)] := Int2Value(1002);
  Done(Map.Value[1]);
  Map.Delete(1);
  AssertEquals('d1) .Count', 2, Map.Count);
  Item := Map.Item[0];
  AssertEquals('d2) Item', 0, Key2Int(Item.Key));
  AssertEquals('d3) Item', 1000, Value2Int(Item.Value));
  Item := Map.Item[1];
  AssertEquals('d4) Item', 2, Key2Int(Item.Key));
  AssertEquals('d5) Item', 1002, Value2Int(Item.Value));
  Assert(@Item = @Item); // hint off
end;

procedure TheVectorMapTest.TestRemove;
var
  Item: TItem;
  Index: Integer;
begin
  AssertTrue('a1) .Remove < 0', Map.Remove(Int2Key(-1)) < 0);
  Map[Int2Key(0)] := Int2Value(1000);
  AssertTrue('b1) .Remove < 0', Map.Remove(Int2Key(-1)) < 0);
  Done(Map[Int2Key(0)]);
  Index := Map.Remove(Int2Key(0));
  AssertEquals('c1) .Remove', 0, Index);
  AssertTrue('d1) .Remove < 0', Map.Remove(Int2Key(-1)) < 0);
  AssertEquals('e1) .Count', 0, Map.Count);
  TearDown;

  SetUp;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  AssertTrue('a2) .Remove < 0', Map.Remove(Int2Key(-1)) < 0);
  Done(Map[Int2Key(0)]);
  Index := Map.Remove(Int2Key(0));
  AssertEquals('b2) .Remove', 0, Index);
  AssertEquals('c2) .Count', 1, Map.Count);
  Item := Map.Item[0];
  AssertEquals('d2) Item', 1, Key2Int(Item.Key));
  AssertEquals('e2) Item', 1001, Value2Int(Item.Value));
  TearDown;

  SetUp;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  Done(Map[Int2Key(1)]);
  Index := Map.Remove(Int2Key(1));
  AssertEquals('a3) .Remove', 1, Index);
  AssertEquals('b3) .Count', 1, Map.Count);
  Item := Map.Item[0];
  AssertEquals('c3) Item', 0, Key2Int(Item.Key));
  AssertEquals('d3) Item', 1000, Value2Int(Item.Value));
  TearDown;

  SetUp;
  Map[Int2Key(0)] := Int2Value(1000);
  Map[Int2Key(1)] := Int2Value(1001);
  Map[Int2Key(2)] := Int2Value(1002);
  Done(Map[Int2Key(1)]);
  Index := Map.Remove(Int2Key(1));
  AssertEquals('a4) .Remove', 1, Index);
  AssertEquals('b4) .Count', 2, Map.Count);
  Item := Map.Item[0];
  AssertEquals('c4) Item', 0, Key2Int(Item.Key));
  AssertEquals('d4) Item', 1000, Value2Int(Item.Value));
  Item := Map.Item[1];
  AssertEquals('e4) Item', 2, Key2Int(Item.Key));
  AssertEquals('f4) Item', 1002, Value2Int(Item.Value));
  Assert(@Item = @Item); // hint off
end;

procedure TheVectorMapTest.TestMap;
var
  A: array[0..4] of TKey;
  I, J: Integer;
begin
  for I := Low(A) to High(A) do begin
    A[I] := Int2Key(I xor $A);
    Map[A[I]] := Int2Value(1000 + I);
    for J := Low(A) to I do
      AssertEquals('V', 1000 + J, Value2Int(Map[A[J]]));
  end;
  // 0 A
  // 1 B
  // 2 8
  // 3 9
  // 4 E
  AssertEquals('K[0]', Key2Int(A[2]), Key2Int(Map.Key[0]));
  AssertEquals('V[0]', 1002, Value2Int(Map.Value[0]));
  AssertEquals('K[1]', Key2Int(A[3]), Key2Int(Map.Key[1]));
  AssertEquals('V[1]', 1003, Value2Int(Map.Value[1]));
  AssertEquals('K[2]', Key2Int(A[0]), Key2Int(Map.Key[2]));
  AssertEquals('V[2]', 1000, Value2Int(Map.Value[2]));
  AssertEquals('K[3]', Key2Int(A[1]), Key2Int(Map.Key[3]));
  AssertEquals('V[3]', 1001, Value2Int(Map.Value[3]));
  AssertEquals('K[4]', Key2Int(A[4]), Key2Int(Map.Key[4]));
  AssertEquals('V[4]', 1004, Value2Int(Map.Value[4]));
end;

initialization
  RegisterTests([
    TheIntVectorMapTest,
    TheStrVectorMapTest,
    TheIntCmpVectorMapTest,
    TheStrCmpVectorMapTest,
    TheInterfaceCmpVectorMapTest,
    TheObjectVectorMapTest
  ]);

end.

